﻿@{
    ViewBag.Title = "Login";
}
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $("#LoginForm").submit(function () {
            if ($("#LoginForm").valid()) {
                $("#LoaderLogin").show();
                $.post($(this).attr("action"), $(this).serialize(), function (response) {
                    $("#LoaderLogin").hide();
                    $("#LoginResult").html("<div id='LoginResult'>" + response + "</div>");
                });
            }
            return false;
        });

        $("#LoginForm").validate({
            messages: {
                UserName: "",
                Password: ""
            }
        });
    });
</script>
<!-- Inicio Session -->
		<!-- BODY -->
		@using (Html.BeginForm("HandleLogin",
			   "Account",
			   FormMethod.Post,
			   new { id = "LoginForm" }))
		   {
		   <input type="hidden" value="@ViewData["__returnUrl"].ToString()" name="ReturnUrl" />
		<table border="0" align="center" cellspacing="5px" style="margin-bottom: 30px; margin: 0 auto">
			<tr>
				<td colspan="2">
					<h1 class="left">
						Iniciar Sesion
					</h1>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<!-- MESSAGE -->
					<div id="LoginResult">
						@if (ViewData["__session"] != null) { Html.RenderPartial("Warning", "Su sesión ha expirado."); }                        
					</div>
				</td>
			</tr>
			<tr>
				<td align="right">
					<label class="black">
						Nombre de usuario:</label>
				</td>
				<td align="left">
					<input type="text" name="UserName" class="required" style="width: 300px;" />
				</td>
			</tr>
			<tr>
				<td align="right">
					<label class="black">
						Contraseña:</label>
				</td>
				<td align="left">
					<input type="password" name="Password" class="required" style="width: 300px;" />
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					@Html.CheckBox("RememberMe")&nbsp;<label>Recordar usuario</label>
				</td>
			</tr>
			<tr id="LoaderLogin" style="display: none;">
				<td colspan="2" align="center">
					<img alt="Loading..." src="@Url.Content("~/Content/img/loader.gif")" />
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" class="boton" value="Iniciar Sesión" style="border-width: 2px;" />
				</td>
			</tr>
		</table>
		}
		<!-- PRELOAD -->
		<img src="@Url.Content("~/Content/img/Botones/Small/useronline.gif")" style="display: none;"
			alt="" />
		<img src="@Url.Content("~/Content/img/Botones/Small/useroffline.gif")" style="display: none;"
			alt="" />
		<img src="@Url.Content("~/Content/img/Botones/Small/edit.png")" style="display: none;"
			alt="" />
		<img src="@Url.Content("~/Content/img/Botones/Small/eliminar.gif")" style="display: none;"
			alt="" />
		
		<img src="@Url.Content("~/Content/img/icons/add.png")" style="display: none;"
			alt="" />
